package net.csdn.business.discuss.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;


/**
 * @ClassName DiscussStateEnum
 * @Description 讨论状态枚举
 * @Author zhangyl
 * @Date 2024/1/5 10:30
 */
@Getter
public enum DiscussStateEnum{

    /**
     * 关闭discuss
     */
    CLOSE("close", "已关闭"),
    /**
     * 打开discuss
     */
    OPEN("open", "重新打开"),


    /**
     * 锁定discuss
     */
    LOCK("lock", "已锁定"),
    /**
     * 解锁discuss
     */
    UN_LOCK("un_lock", "未锁定");

    @EnumValue
    private String code;
    @EnumValue
    private String desc;

    @JsonCreator
    DiscussStateEnum(String code , String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static DiscussStateEnum get(String code) {
        for (DiscussStateEnum sourceType : DiscussStateEnum.values()) {
            if (sourceType.code.equals(code)) {
                return sourceType;
            }
        }
        throw new IllegalArgumentException("code param error");
    }

}
